package wsz.global;

import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.common.message.Message;

/**
 * 全局有序消息
 * @author wsz
 * @date 2022/2/28 10:43
 **/
public class GlobalOrderProducer {

    // 正常生产，有序消费交予消费端
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("consumer_grp_wsz");
        producer.setNamesrvAddr("192.168.174.138:9876");
        producer.start();
        Message message = null;
        for (int i = 0; i < 100; i++) {
            message = new Message("tp_demo_08", ("order" + i).getBytes());
            producer.send(message);
        }
        producer.shutdown();
    }
}
